package com.lening.security.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lening.common.util.OssUtil;
import com.lening.common.web.Result;
import com.lening.security.dto.ClassifyDTO;
import com.lening.security.po.ClassifyPO;
import com.lening.security.service.IClassifyService;
import com.lening.common.base.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author 赵子豪
 * @date 2024年06月04日 09时08分58秒
 * 巡更分类
 */
@Slf4j
@RestController
@RequestMapping("classify")
public class ClassifyController extends BaseController<ClassifyPO, ClassifyDTO, IClassifyService> {

//    @Resource
//    @Qualifier("iClassifyService")
    @Autowired
    private IClassifyService iClassifyService;

    @GetMapping("classifypage")
    public Page<ClassifyDTO> classifypage(ClassifyDTO classifyDTO){
        Page<ClassifyDTO> classifypage = iClassifyService.classifypage(classifyDTO);
        return classifypage;
    }


//    @PostMapping("upload")
//    public Map<String, String> upload(@RequestParam("file") MultipartFile file) {
//        return iClassifyService.upload(file);
//    }

//    上传
    @PostMapping("UpLoad")
    public Result<?> upload(MultipartFile multipartFile) {
        String s = OssUtil.uploadFileAvatar(multipartFile);
        return Result.ok(s);
    }

}